
public class SwitchTimeTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		float PST[][] = new float[5][5];
		PST[0][0]=0;
		PST[0][1]=1;
		PST[0][2]=2;
		PST[0][3]=3;
		PST[0][4]=4;
		PST[1][0]=1;
		PST[1][1]=2;
		PST[1][2]=3;
		PST[1][3]=3;
		PST[1][4]=3;
		PST[2][0]=2;
		PST[2][1]=2;
		PST[2][2]=3;
		PST[2][3]=2;
		PST[2][4]=3;
		PST[3][0]=3;
		PST[3][1]=2;
		PST[3][2]=3;
		PST[3][3]=3;
		PST[3][4]=3;
		PST[4][0]=4;
		PST[4][1]=2;
		PST[4][2]=2;
		PST[4][3]=4;
		PST[4][4]=2;
		int rowSum = 0, colSum=0;;
		float[] rowAvg = new float[5];
		float[] colAvg = new float[5];
		for (int i = 0; i < PST.length; i++) {
			for (int j = 0; j < PST.length; j++) {
				rowSum += PST[i][j];
				colSum += PST[j][i];
			}
			rowAvg[i]=rowSum/(float)PST.length;
			colAvg[i]=colSum/(float)PST.length;
			rowSum=0;
			colSum=0;
		}
		float[] avg = new float[5];
		avg[0] = (float) ((rowAvg[0]+colAvg[0])/2.0);
		avg[1] = (float) ((rowAvg[1]+colAvg[1])/2.0);
		float avgSetupTime = avg[0]+avg[1];
		System.out.println("Avg setup time: " + avgSetupTime);
	}
}
